package com.znjb.myapplication;

import androidx.fragment.app.Fragment;

/**
 * Fragment的工厂类
 *
 * @author Administrator
 */
public class FragmentFactory {
    /**
     * 根据不同的position生产对应的Fragment对象
     *
     * @param position
     * @return
     */
    public static Fragment create(int position) {
        Fragment fragment = null;
        switch (position) {
            case 0:
//			fragment = new HomeFragment();
                fragment = new Fragment_1();
                break;
            case 1:
//			fragment = new AppFragment();
                fragment = new Fragment_2();
                break;
            case 2:
//			fragment = new GameFragment();
                fragment = new Fragment_3();
                break;
            case 3:
//			fragment = new SubjectFragment();
                fragment = new Fragment_4();
                break;
            case 4:
//			fragment = new RecommendFragment();
                fragment = new Fragment_5();
                break;
            case 5:
//			fragment = new CategoryFragment();
                fragment = new Fragment_6();
                break;
            case 6:
//			fragment = new HotFragment();
                fragment = new Fragment_7();
                break;

            case 7:
//			fragment = new CategoryFragment();
                fragment = new Fragment_8();
                break;
            case 8:
//			fragment = new HotFragment();
                fragment = new Fragment_9();
                break;


        }
        return fragment;
    }

}
